package com.auxgroup.smarthome.business.service;

import com.auxgroup.bridge.app.inner.vo.AppUserVo;
import com.auxgroup.smarthome.business.service.inner.AppUserDBInnerService;
import com.auxgroup.smarthome.utils.PageContent;
import com.auxgroup.smarthome.web.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author: laiqiuhua.
 * @Date: 2017/8/15 11:12.
 */
@Service
public class AppUserService {

    @Autowired
    private AppUserDBInnerService appUserDBInnerService;


    /**
     * 获取设备详情
     * @param uid
     * @return
     */
    public ApiResponse<AppUserVo> getAppUser(String uid) {
        return appUserDBInnerService.getAppUser(uid);
    }

    public ApiResponse<Page<AppUserVo>> getAppUserList(String keywords, Integer page, Integer size) {
        ApiResponse<PageContent<AppUserVo>> apiResponse = appUserDBInnerService.getAppUserList(keywords, page,size);
        Page<AppUserVo> pageContent = apiResponse.getData().convertPage();
        return new ApiResponse(apiResponse.getCode(), apiResponse.getMessage(), pageContent);
    }

    public ApiResponse<List<AppUserVo>> getAllAppUser(String keywords) {
        return appUserDBInnerService.getAllAppUser(keywords);
    }


}
